<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/init.jsp"%>
<link href="<c:url value='/admin/css/custom.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/admin/css/style.css'/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<style type="text/css">
<!--
body {
	background: #ffffff;
	margin-top:10px;
	margin-left:5px;
	margin-right:5px;
}
-->
</style>
<body>
<div class="EpmsSubTitle"><p><b>新闻管理</b></p>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="EpmsTable">
  <tr>
	  <td class=EpmsTdTitle width="45%">主题</td>
	  <td class="EpmsTdTitle" width="15%">分类</td>
	  <td class=EpmsTdTitle width="25%">发布时间</td>
	  <td class=EpmsTdTitle width="15%">操作</td>
  </tr>
	<c:forEach var="news" items="${page.result }">
		<tr>
		    <td class=EpmsTdNoColor><a href="${ctx}/admin/newsinfo.action?id=${news.id}">${news.title }</a></td>
			<td class="EpmsTdNoColor" align="center">
				<c:forEach var="neww" items="${newsList}">
	              	<c:if test="${neww.code eq news.type}">${neww.name}</c:if>
				  </c:forEach>
			</td>
		    <td class=EpmsTdNoColor align="center">
		    	<fmt:formatDate value="${news.createDate}" pattern="yyyy-M-dd HH:mm:ss"/>
		    </td>
		    <td class=EpmsTdNoColor align="center">
		    	<a href="${ctx}/admin/newsinfo.action?id=${news.id}">修改</a>  |    
		    	<a href="javascript:deletenews('${news.id }');" id="deletenews">删除</a>
		    </td>
		</tr>
	</c:forEach>
	<tr>
		<td class="EpmsTdNoColor" colspan="4" align="right">
		第${page.pageNo}页&nbsp;&nbsp;
			<c:choose>
			<c:when test="${page.pageNo >1}">
				<a href="javascript:void(0);" style="text-decoration: none;">
					<span onclick="frontpage(${page.pageNo-1})">上一页</span>&nbsp;
				</a>
			</c:when>
			<c:otherwise>
				上一页 &nbsp;
			</c:otherwise>
			</c:choose>
			<c:choose>
				<c:when test="${page.totalPageCount > page.pageNo}">	
					<a href="javascript:void(0);" style="text-decoration: none;">
						<span onclick="nextpage(${page.pageNo+1})">下一页</span> &nbsp;
					</a>
				</c:when>
				<c:otherwise>
					下一页&nbsp;
				</c:otherwise>
			</c:choose>
			&nbsp;共${page.totalPageCount }页
		</td>
	</tr>
</table>
</body>
<script type="text/javascript">
function frontpage(pageNo){
	location = "${ctx}/admin/newslist.action?pageNo="+pageNo;
}

function nextpage(pageNo){
	location = "${ctx}/admin/newslist.action?pageNo="+pageNo;
}

//${ctx}/admin/deletenews.action?id=${news.id}
function deletenews(id){
	if(window.confirm("确认删除？"))
		location = "${ctx}/admin/deletenews.action?id="+id;
}
</script>